<!DOCTYPE html>
<html lang="en">
<head>
    <base href="/">
    <meta charset="UTF-8" xmlns:th="http://www.thymeleaf.org">
    <title>Title</title>
    <link rel="stylesheet" href="../static/layui/layui/modules/layui.all.js">
    <style>
        #imgbox img{
            width:100px;

        }
    </style>
</head>
<body>
<button type="button" id="uploadBTN" class="layui-btn">上传</button>
<div id="imgbox"></div>
<script src="../static/layui/layui/modules/layui.all.js"></script>
<script>
    const upload=layui.upload;
    const $=layui.$;
    upload.render({
        elem:'#uploadBTN',
        url:"file/upload",
        done:function(result){

            let src=result.data[0].src;
            $("#imgbox").append("<img src='"+src+"'/>")
        },
        error:function(){}
    });
</script>
</body>
</html>